package com.zlsy.springbootdemo.controller;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author zhouliang
 * @date 2021/1/23 11:31
 */
@Getter
@AllArgsConstructor
public enum TestEnum {
  /** test */
  SF("SF"),
  JD("JD");
  private String code;

  public static TestEnum get(String code) {
    return Arrays.stream(values())
        .filter(value -> value.code.equals(code))
        .findFirst()
        .orElse(null);
  }
}
